﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace XTYAPI.PLC
{
    
    public static partial class FC
    {
        /// <summary>
        /// 缩放指令将按以下公式进行计算：
        /// OUT = [VALUE ∗ (MAX – MIN)] + MIN
        /// </summary>
        public static float SCALE_X(float min, float value,float max)
        {
            if (value < 0|| value > 1.0)
            {
                throw new Exception("执行缩放前 请先(标准化)量化value(0.0,1.0)");
            }
            else
            {
                return value * (max - min) + min;
            }
        }
       
    }
}
